package com.wenhai.springbook.factorybean;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * {@link FactoryBean} 示例
 *
 * @author wenhai
 * @date 2020/10/9
 */
public class FactoryBeanDemo {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("META-INF/factory-bean.xml");
        Car car = ctx.getBean("car", Car.class);
        CarFactoryBean carFactoryBean = ctx.getBean("&car", CarFactoryBean.class);
        System.out.println(car);
        System.out.println(carFactoryBean);
    }
}
